<?php
/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Vote
 * @copyright  Copyright KEENONWEB LLC
 * @license    http://www.keenonweb.com/
 * @version    $Id: Level.php 2011-03-09 08:45:41Z idris $
 * @author     Idris
 */

/**
 * @category   Application_Extensions
 * @package    Vote
 * @copyright  Copyright KEENONWEB LLC
 * @license    http://www.keenonweb.com/
 */

class Vote_Form_Admin_Settings_Level extends Authorization_Form_Admin_Level_Abstract {
	public function init() {
		parent::init ();
		
		$this->setTitle ( 'Member Level Settings' )->setDescription ( "VOTE_FORM_ADMIN_LEVEL_DESCRIPTION" );
		
		// Element: view
		$this->addElement ( 'Radio', 'view', array ('label' => 'Allow Viewing of Voting?', 'description' => 'Do you want to let members view votings? If set to no, some other settings on this page may not apply.', 'multiOptions' => array (2 => 'Yes, allow viewing of all votings, even private ones.', 1 => 'Yes, allow viewing of votings.', 0 => 'No, do not allow votings to be viewed.' ), 'value' => ($this->isModerator () ? 2 : 1) ) );
		
		if (! $this->isModerator ()) {
			unset ( $this->view->options [2] );
		}
		
		if (! $this->isPublic ()) {
			
			// Element: create
			$this->addElement ( 'Radio', 'create', array ('label' => 'Allow Creation of Votings?', 'description' => 'Do you want to let members create votings? If set to no, some other settings on this page may not apply. This is useful if you want members to be able to view votings, but only want certain levels to be able to create votings.', 'multiOptions' => array (1 => 'Yes, allow creation of votings.', 0 => 'No, do not allow votings to be created.' ), 'value' => 1 ) );
			
			// Element: edit
			$this->addElement ( 'Radio', 'edit', array ('label' => 'Allow Editing of Votings?', 'description' => 'Do you want to let members edit votings? If set to no, some other settings on this page may not apply.', 'multiOptions' => array (2 => 'Yes, allow members to edit all votings.', 1 => 'Yes, allow members to edit their own votings.', 0 => 'No, do not allow members to edit their votings.' ), 'value' => ($this->isModerator () ? 2 : 1) ) );
			if (! $this->isModerator ()) {
				unset ( $this->edit->options [2] );
			}
			
			// Element: delete
			$this->addElement ( 'Radio', 'delete', array ('label' => 'Allow Deletion of Votings?', 'description' => 'Do you want to let members delete votings? If set to no, some other settings on this page may not apply.', 'multiOptions' => array (2 => 'Yes, allow members to delete all votings.', 1 => 'Yes, allow members to delete their own votings.', 0 => 'No, do not allow members to delete their votings.' ), 'value' => ($this->isModerator () ? 2 : 1) ) );
			if (! $this->isModerator ()) {
				unset ( $this->delete->options [2] );
			}
			
			// Element: comment
			$this->addElement ( 'Radio', 'comment', array ('label' => 'Allow Commenting on Votings?', 'description' => 'Do you want to let members of this level comment on votings?', 'multiOptions' => array (2 => 'Yes, allow members to comment on all votings, including private votings.', 1 => 'Yes, allow members to comment on votings.', 0 => 'No, do not allow members to comment on votings.' ), 'value' => ($this->isModerator () ? 2 : 1) ) );
			
			// Element: participate
			$this->addElement ( 'Radio', 'participate', array ('label' => 'Allow Participating in Votings?', 'description' => 'Do you want to let members of this level participate in votings?', 'multiOptions' => array (2 => 'Yes, allow members to participate in all votings, including private votings.', 1 => 'Yes, allow members to participate in votings.', 0 => 'No, do not allow members to participate in votings.' ), 'value' => 1 ) );
			
			// Element: participate
			$this->addElement ( 'Radio', 'vote', array ('label' => 'Allow Voting?', 'description' => 'Do you want to let members of this level vote?', 'multiOptions' => array (2 => 'Yes, allow members to vote on all votings, including private votings.', 1 => 'Yes, allow members to vote.', 0 => 'No, do not allow members to vote.' ), 'value' => 1 ) );
			
			// Element: style
			$this->addElement ( 'Radio', 'style', array ('label' => 'Allow Voting Style', 'required' => true, 'multiOptions' => array (2 => 'Yes, allow members to style all votings, including private votings.', 1 => 'Yes, allow custom voting styles.', 0 => 'No, do not allow custom voting styles.' ), 'value' => 1 ) );
			
			if (! $this->isModerator ()) {
				unset ( $this->comment->options [2] );
			}
			
			// Element: auth_view
			$this->addElement ( 'MultiCheckbox', 'auth_view', array ('label' => 'Voting Privacy', 'description' => 'Your members can choose from any of the options checked below when they decide who can see their votings. These options appear on your members\' "Create Voting" and "Edit Voting" pages. If you do not check any options, everyone will be allowed to view voting.', 'multiOptions' => array ('everyone' => 'Everyone', 'registered' => 'All Registered Members', 'owner_network' => 'Friends and Networks', 'owner_member_member' => 'Friends of Friends', 'owner_member' => 'Friends Only', 'owner' => 'Just Me' ), 'value' => array ('everyone', 'registered', 'owner_network', 'owner_member_member', 'owner_member', 'owner' ) ) );
			
			// Element: auth_comment
			$this->addElement ( 'MultiCheckbox', 'auth_comment', array ('label' => 'Voting Comment Options', 'description' => 'Your members can choose from any of the options checked below when they decide who can post comments on their votings. If you do not check any options, everyone will be allowed to post comments on votings.', 'multiOptions' => array ('registered' => 'All Registered Members', 'owner_network' => 'Friends and Networks', 'owner_member_member' => 'Friends of Friends', 'owner_member' => 'Friends Only', 'owner' => 'Just Me' ), 'value' => array ('registered', 'owner_network', 'owner_member_member', 'owner_member', 'owner' ) ) );
			
			$this->addElement ( 'MultiCheckbox', 'auth_participate', array ('label' => 'Voting Participation Options', 'description' => 'Your members can choose from any of the options checked below when they decide who can participate in their votings. If you do not check any options, everyone will be allowed to participate in votings.', 'multiOptions' => array ('registered' => 'All Registered Members', 'owner_network' => 'Friends and Networks', 'owner_member_member' => 'Friends of Friends', 'owner_member' => 'Friends Only', 'owner' => 'Just Me' ), 'value' => array ('registered', 'owner_network', 'owner_member_member', 'owner_member', 'owner' ) ) );
			
			$this->addElement ( 'MultiCheckbox', 'auth_vote', array ('label' => 'Vote Options', 'description' => 'Your members can choose from any of the options checked below when they decide who can vote in their votings. If you do not check any options, everyone will be allowed to vote in votings.', 'multiOptions' => array ('registered' => 'All Registered Members', 'owner_network' => 'Friends and Networks', 'owner_member_member' => 'Friends of Friends', 'owner_member' => 'Friends Only', 'owner' => 'Just Me' ), 'value' => array ('registered', 'owner_network', 'owner_member_member', 'owner_member', 'owner' ) ) );
			
			// Element: auth_html
			$this->addElement ( 'Text', 'auth_html', array ('label' => 'HTML in Description of Votings?', 'description' => 'If you want to allow specific HTML tags, you can enter them below (separated by commas). Example: b, img, a, embed, font', 'value' => 'strong, b, em, i, u, strike, sub, sup, p, div, pre, address, h1, h2, h3, h4, h5, h6, span, ol, li, ul, a, img, embed, br, hr' ) );
			
			// Element: max
			$this->addElement ( 'Text', 'max', array ('label' => 'Maximum Allowed Votings?', 'description' => 'Enter the maximum number of allowed votings. The field must contain an integer between 1 and 999, or empty for unlimited.', 'validators' => array (array ('Int', true ), new Engine_Validate_AtLeast ( 0 ) ) ) );
		
		}
	}
}